package com.ruoyi.gxdj.controller;

import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.entity.SysDictData;
import com.ruoyi.common.core.domain.entity.SysDictType;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.system.domain.SysNotice;
import com.ruoyi.system.service.ISysDictDataService;
import com.ruoyi.system.service.ISysDictTypeService;
import com.ruoyi.system.service.ISysNoticeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 公告 信息操作处理
 * 
 * @author ruoyi
 */
@RestController
@RequestMapping("/wechat/system")
public class WeChatSysNoticeController extends BaseController
{
    @Autowired
    private ISysNoticeService noticeService;

    @Autowired
    private ISysDictDataService dictDataService;


    /*
    * 查新闻字典
    * */
    @GetMapping("/listType")
    public AjaxResult listType(){
        List<SysDictData> list = dictDataService.listNewType();
        return AjaxResult.success(list);
    }

    /**
     * 获取新闻列表
     */
    @GetMapping("/list")
    public AjaxResult list(SysNotice notice)
    {
        List<SysNotice> list = noticeService.selectNoticeListToWe(notice);
        return AjaxResult.success(list);
    }

    /*
    * 查公告
    * */
    @GetMapping("/listNotice")
    public AjaxResult listNotice(){
        List<SysNotice> list =  noticeService.selectNoticeListwe();
        return AjaxResult.success(list);
    }



    /**
     * 根据通知公告编号获取详细信息
     */
    @GetMapping(value = "/{noticeId}")
    public AjaxResult getInfo(@PathVariable Long noticeId)
    {
        return success(noticeService.selectNoticeById(noticeId));
    }

}
